﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CampaignDataPdfConverter
{
    public class Brands
    {
        public Brand FindOrCreateBrand(string brandName)
        {
            foreach (Brand b in brands)
                if (b.brandName == brandName) return b;
            Brand newB = new Brand();
            newB.brandName = brandName;
            brands.Add(newB);
            return newB;
        }

        public readonly List<Brand> brands = new List<Brand>();
    }

    public class Brand
    {
        public string
            brandName;

        public Campaign FindOrCreateCampaign(string campaignType)
        {
            foreach (Campaign c in campaigns)
                if (c.campaignType == campaignType) return c;
            Campaign newC = new Campaign();
            newC.campaignType = campaignType;
            campaigns.Add(newC);
            return newC;
        }
        public readonly List<Campaign> campaigns = new List<Campaign>();
    }

    public class Campaign
    {
        // campaign has fields
        public string
            campaignType,
            projectNumber;

        // campaign has ad groups
        public readonly List<AdGroup> adGroups = new List<AdGroup>();

        // finding an adgroup by name
        public AdGroup FindOrCreateAdGroup(string adGroupName)
        {
            foreach (AdGroup a in adGroups)
                if (a.adGroupName == adGroupName) return a;
            AdGroup newA = new AdGroup();
            newA.adGroupName = adGroupName;
            adGroups.Add(newA);
            return newA;
        }
    }

    public class AdGroup
    {
        // campaign has these fields
        public string
            adGroupName,
            mobileUrl,
            tabletUrl,
            desktopUrl;

        // campaign has several ads
        public readonly List<Ad> ads = new List<Ad>();

        // campaign has several keywords
        public readonly List<string> keywords = new List<string>();
    }

    public class Ad
    {
        // ad has these fields
        public string
            headline,
            line1,
            line2,
            type1Url,
            shortededType1Url,
            type2Url,
            shortededType2Url;
    }
}
